<template>
  <div id="Home">
    <!-- <x-header title="slot:overwrite-title" style="background:#ffffff;" :right-options="{showMore: true}" @on-click-more="showMenus = true">
      <div class="overwrite-title-demo" slot="overwrite-title">
        <button-tab  v-model="index">
          <button-tab-item :selected="demo2 === item" v-for="(item, index) in lists"  :key="index" @on-item-click="consoleIndex(index)">{{item}}</button-tab-item>        
        </button-tab>
      </div>
       
    </x-header> -->

    <x-header title="slot:overwrite-title" style="opacity:0.6; position:fixed;top:0px;z-index:1000;width:100%">
      <div class="overwrite-title-demo" slot="overwrite-title">
        <button-tab>
          <button-tab-item selected>商品</button-tab-item>
          <button-tab-item>评论</button-tab-item>
          <button-tab-item>详情</button-tab-item>
        </button-tab>
      </div>
    </x-header>


    <!-- <x-header title="购物车" style="position:fixed;top:0px;z-index:1000;width:100%" :left-options="{showBack: false}" @on-click-more="show = false">
      <a slot="right">
      </a>
    </x-header> -->


    <div class="wrapsDetail" >
      <div v-show="indexs==0">
        <swiper style="" loop auto :list="itemImgUrl" :index="itemImgIndex" @on-index-change="demo06_onIndexChange"></swiper>
        <div class="goods_wrap">
          <div class="isinMiaosha" v-if="ismiaosha">
            <div class="ismiaoFirst">￥{{goodsData.shop_price}} <span id="texthua">￥{{goodsData.market_price}}</span></div>
            <div class="ismiaoSecnd">
              <p class="huodongTime">距离结束还剩：</p>
              <clocker time="2018-02-15">
                <span class="day">%_H1</span>
                <span class="day">%_H2</span>:
                <span class="day">%_M1</span>
                <span class="day">%_M2</span>:
                <span class="day">%_S1</span>
                <span class="day">%_S2</span>
              </clocker>
            </div>
          </div>
          <div class="goods_info">
            <div class="goods_left">
              <p>{{goodsData.goodsname}}</p>
              <p>{{goodsData.standard}}</p>
            </div>
          </div>
          <div class="good_price">
            <b v-show="ismiaosha==false && isJifen == false"><span id="price"><span style="color:#E64340">￥{{goodsData.market_price}}</span></span></b>
            <b v-show="isJifen == true"><span id="price"><span style="color:#E64340">{{goodsData.jifenprice}}积分</span></span></b>
            <span id="free">运费:{{goodsData.transportmoney}}</span>
            <div class="backMoney" style="border-radius:7.8px;">返利{{goodsData.rebate}}</div><br>
            <div class="allshops">
              <div class="shop—item">库存:{{goodsData.counts}}</div>
              <div class="shop-ping">0人评价</div>
              <div class="shop-person">{{goodsData.sellcount}}人已购</div>
            </div>
          </div>
        </div>
        <!-- 口味，规格 -->
        <div class="goods_format">
          <div class="chooseType" @click="chooseColor">规格<img src="static/cart/yjt@2x.png" alt=""></div>
          <div class="chooseType" @click="chooseType">参数<img src="static/cart/yjt@2x.png" alt=""></div>
        
          <!-- 弹框 -->
          <!--规格 弹框-->
          <div v-transfer-dom>
            <popup style="border-radius:1em;" v-model="show13" position="bottom" max-height="85%">
              <div class="dialog-box">
                <div class="dialog-top" >
                  <div class="dialog-img"><img :src="isUndefined(goodsData.lunbo)" alt=""></div>
                  <div class="dialog-text"> 
                    <p><span id="color">{{goodsData.shopname}}</span>{{goodsData.goodsname}}</p>
                    <p class="day">{{goodsData.uptime}}</p>
                    <p style="color:#cc0010">￥{{goodsData.market_price}}</p>
                  </div>
                  <div class="dialog-close" @click="closePu">
                    <span id="vux-close"><img src="static/cart/closed.png" width="20" alt=""></span>      
                  </div>
                </div>
                <!-- 口味 -->
                <div class="goods_format_" v-for="(item , index) in guige" :key="index" :value="item">
                  <p class="_format" >{{item.title}}</p>
                  <div class="_checker">
                    <checker
                      radio-required
                      default-item-class="demo6-item"
                      selected-item-class="demo6-item-selected"
                      >
                        <checker-item @on-item-click="tasteChoose" v-for="(minItem,index) in item.data" :key="index" :value="minItem">{{minItem}}</checker-item>
                    </checker>
                  </div>
                </div>
                <!-- 购买数量 -->
                <div class="buyNum">
                  <div class="num"><span>购买数量</span></div>
                  <div class="xnum"> 
                      <group>
                        <x-number title="" v-model="nums" button-style="round"></x-number>
                      </group>
                    </div>
                </div>
                <!-- 底部 -->
                <div class="botsWrap" >
                  <div class="bottom_">
                    <div class="addCart" @click="add_cart">加入购物车</div>
                    <div class="buyIt" @click="go_buy">立即购买</div>
                  </div>
                </div>
              </div>
            </popup>
          </div>

          <!--参数 弹框-->
          <div v-transfer-dom>
            <popup style="border-radius:1em;" v-model="show14" position="bottom" max-height="85%">
              <div class="dialog-box">
                <div class="dialog-top" >
                  <div class="dialog-text" style="text-align:center;"> 
                    产品参数
                  </div>
                </div>
                <!-- 参数 -->
                <div class="goods_format_" v-for="(item , index) in canshu" :key="index" :value="item">
                  <div style="overflow:hidden; padding-top:0.7em;">
                    <div style="float:left; width:20%; color:#333; font-size:1.01em;">{{item.title}}</div>
                    <div style="float:right; width:66%; color:#999; font-size:0.9em;">
                      <span class="" v-for="(minItem,index) in item.data" :key="index" :value="minItem">{{minItem}}     </span>
                    </div>
                  </div>
                </div>
                  
                <!-- 底部 -->
                <div class="botsWrap" >
                  <div class="bottom_">
                    <div style="border-radius:10px;" class="addCart" @click="canshuFinish">完成</div>
                  </div>
                </div>
              </div>
            </popup>
          </div>
        </div>
        <alert v-model="tankuang" :title="('提示')" @on-show="onShow" @on-hide="onHide"> 请先选择商品规格</alert>

        <div class="format_info">
          <div class="format_more">
            <evaluate-page :evalDatas="evalDatas"></evaluate-page>        
          </div>
        </div>
      </div>

      <!-- <div v-show="indexs==1" > -->
      <div class="my_xiangqing" >
        <!-- 规格介绍 -->
        <div class="details" v-html="goodsDetail">
        </div>
      </div>

      <!-- <div v-show="indexs==2"> -->
      <div class="my_pingjia">
        <evaluate-page :evalDatas="evalDatas"></evaluate-page>
      </div>
    </div>
    <!-- 底部固定 -->
    <div class="bottom_bar">
      <div class="bottom_item" @click="myHistory"><img src="static/bottom/hos.png" alt=""><p>浏览记录</p></div>
      <div class="bottom_item" @click="myFavourites" v-model="isFav"><img :src="srcData" alt=""><p>收藏</p></div>
      
      <div class="bottom_item" @click="go_cart"><img src="static/bottom/car.png" alt=""><p>购物车</p></div>
      <div class="bottom_item" @click="addCartTan">加入购物车</div>
      <div class="bottom_item" @click="addBuy">立即购买</div>
      <div class="badge">
        <badge :text="nums"></badge>
      </div>
    </div>
    <!-- 浏览记录 -->
    <div v-transfer-dom>
      <popup v-model="show8" position="left" width="40%">
        <div class="position-horizontal-demo myView">
          <p>浏览记录</p>
          <div class="myViews" v-for="(item,index) in myViewData" :key="index" :value="index" @click="lookRecord(item.goods.goodsid)">
              <div><img :src="urlList(item.goods.product_thumb_image)" alt="" ></div>
              <div class="fonts">{{item.goods.goodsname}}</div>
              <div>￥{{item.goods.shop_price}}</div>
          </div>
          <span class="vux-close" @click="show8 == false"></span>
        </div>
      </popup>
    </div>
    <toast position="bottom" v-model="messShow" type="text">{{message}}</toast>   
  </div>
</template>

<script>
import {
  Swiper,
  XNumber,
  Popup,
  XButton,
  SwiperItem,
  Group,
  ButtonTab,
  ButtonTabItem,
  Toast,
  XSwitch,
  XDialog,
  Grid,
  GridItem,
  GroupTitle,
  XHeader,
  Checker,
  CheckerItem,
  TransferDomDirective as TransferDom,
  Badge,
  Clocker,
  Alert
} from "vux";
const baseList = [
  {
    url: "javascript:",
    img: "https://static.vux.li/demo/1.jpg"
  },
  {
    url: "javascript:",
    img: "https://static.vux.li/demo/2.jpg"
  },
  {
    url: "javascript:",
    img: "https://static.vux.li/demo/3.jpg"
  }
];
import evaluatePage from "../../components/toolComponent/myEvaluate";
import { homeUrl } from "../../components/utils/utils.js";
import axios from "axios";
import qs from "qs";
import $ from 'jquery';

const urlList = baseList.map((item, index) => ({
  url: "http://m.baidu.com",
  img: item.img
}));
const shangpinListFn = () => [];
export default {
  directives: {
    TransferDom
  },
  components: {
    Swiper,
    SwiperItem,
    Grid,
    GridItem,
    GroupTitle,
    CheckerItem,
    XHeader,
    Checker,
    Toast,
    XDialog,
    XButton,
    Group,
    XNumber,
    Badge,
    Popup,
    XSwitch,
    ButtonTab,
    ButtonTabItem,
    evaluatePage,
    Toast,
    Clocker,
    Alert
  },
  data() {
    return {
      isJifen:this.$route.params.isjifen == true ? true : false , 
      guige:[] , 
      canshu:[] , 
      demo06_list: urlList,
      demo06_index: 0,
      swiperItemIndex: 1,
      roundValue: 1,
      isfalse: false,
      demo6: 1,
      nums: 1,
      show: false,
      istrue: false,
      show2: false,
      showToast: false,
      showHideOnBlur: false,
      showScrollBox: false,
      showDialogStyle: false,
      lists: ["商品", "详情", "评价"],
      demo2: "商品",
      index: 0,
      messShow: false,
      message: "",
      indexs: 0,
      tankuang:false,
      confirmBuy: false,
      confirmAdd: false,
      colorType: false,
      show13: false,
      show14:false,
      show8: false,
      isFav: false,
      goodsId: this.$route.params.goodsId,
      goodsDetail: "",
      goodsData: {},
      evalDatas: "",
      itemImgUrl: [],
      goodsDataColor: "",
      goodsDataSize: "",
      itemImgIndex: 0,
      srcData: "static/bottom/favorite.png",
      myViewData: [],
      tasteChooses: "",
      sizeChooses: "",
      ismiaosha:null,
       wxOpenId:localStorage.getItem("openid"),
    };
  },
  methods: {
    canshuFinish(){
      this.show14 = !this.show14;
    } , 
    closePu() {
      this.show13 = !this.show13;
    },
    // 收藏商品判断
    myFavourites() {
      // static/bottom/shouyeh@2x.png
      // console.log("shang");
      // console.log(this.isFav);
      this.isFav = !this.isFav;
      if (this.isFav == false) {
        console.log("取消i奥收藏");
        this.srcData = "static/bottom/favorite.png";
        var dataList = qs.stringify({
          wxid: "oCBm3vxlqwJjUbBDshKiQ50IFSjs",
          tablename: "favorite"
        });
        axios
          .post(homeUrl() + "favoriteAndLookTableManageJsonSelect/", dataList, {
            emulateJSON: true
          })
          .then(
            result => {
                console.log(result)
              
              if (result.data.status == "ok") {
                var favList = result.data.data;
                for (var i = 0; i < favList.length; i++) {
                  if (favList[i].goods.goodsid == this.goodsId) {
                    this.delFav(favList[i].id);
                  }
                }
              }
            },
            error => {
              this.$vux.toast.text("网络请求失败....", "bottom");
              console.log(error);
            }
          );
      } else {
        console.log("收藏成功");
        this.srcData = "static/cart/ysc.png";
        this.beginShou("favorite");
      }
    },
    onHide() {
      console.log("on hide");
    },
    onShow() {
      // console.log("on show");
    },
    // 开始收藏
    beginShou(type) {
      // console.log(this.itemImgUrl[0]);
      // alert(this.wxOpenId)
      var datas = qs.stringify({
        wxid: "oCBm3vxlqwJjUbBDshKiQ50IFSjs",
        // goodsname: this.goodsData.goodsname,
        goodsid: this.goodsData.goodsid,
        // goodsimage: this.itemImgUrl[0].img,
        // goodsparams1: this.goodsData.color,
        // goodsparams2: this.goodsData.size,
        // shopname: this.goodsData.shopname,
        // goodsprice: this.goodsData.price,
        tablename: type
      });
      axios
        .post(homeUrl() + "favoriteAndLookTableManageJsonAdd/", datas, {
          emulateJSON: true
        })
        .then(
          result => {
            console.log(";;;;;;;;;;;;;;;;;;;;;;;;;;");
            console.log(result)
            if (result.data.status == "ok" && type == "favorite") {
              this.messShow = true;
              this.message = "收藏成功";
            } else if (result.data.status == "ok" && type == "lookhistory") {
              console.log("浏览记录成功添加");
            }
          },
          error => {
            this.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    // 图片是否为空
    isUndefined(datas){
      if (datas == undefined || datas.length <= 0) {
        return
      }
      return homeUrl()+datas[0].image
    },
    // 取消收藏
    delFav(canceld) {
      // console.log("...........")
      // console.log(canceld)
      // console.log(canceld.split())
      var arr = canceld.split(",");
      console.log(arr);
      var datas = qs.stringify({
        ids: JSON.stringify(arr),
        tablename: "favorite"
      });
      axios
        .post(homeUrl() + "cartstableManageJsonDelete/", datas, {
          emulateJSON: true
        })
        .then(
          result => {
            console.log(result);
            if (result.data.status == "ok") {
              this.messShow = true;
              this.message = "取消收藏";
            }
          },
          error => {
            this.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    // 选择颜色
    chooseColor() {
      // console.log("....");
      this.confirmAdd = false;
      this.confirmBuy = false;
      this.colorType = true;
      this.show13 = !this.show13;
      console.log(this.goodsData)
      // console.log(this.goodsData.color);
      var colorArr = this.goodsData.color;
      this.goodsDataColor = this.goodsData.goodsparams1.split("，");
      this.goodsDataSize = this.goodsData.goodsparams2.split("，");
    },
    urlList(imgObj){
      if(imgObj!=null){
          //  var datasSrc=imgObj.split("---");
          var srcUrl=homeUrl()+imgObj;
          // console.log(srcUrl)
          return srcUrl
      }
       
    },
    // 浏览记录点击
    lookRecord(goodsids){
      // console.log(goodsids)
      localStorage.setItem("goodsid" , goodsids)

      window.location.reload()

      // this.$router.push({
      //   name: 'goods_detail',
      //   params: {
      //     goodsId: goodsids
      //   }
      // })
    },
    // 产品参数
    chooseType() {
      // this.isfalse = !this.isfalse;
      this.show14 = !this.show14;
    },
    demo06_onIndexChange(index) {
      //   console.log(index)
      this.demo06_index = index;
    },
    // 加入购物车
    add_cart() {
        this.goodsDataColor = this.goodsData.goodsparams1.split("，");
        this.goodsDataSize = this.goodsData.goodsparams2.split("，");

        var currentParams = ""
        $(".demo6-item-selected").each(function (i , item) {
          currentParams = currentParams + " " + $(item).text()
        })


        var datas = qs.stringify({
          wxid: "oCBm3vxlqwJjUbBDshKiQ50IFSjs",
          // goodsname: this.goodsData.goodsname,
          goodsid: this.goodsData.goodsid,
          goodsimage: this.itemImgUrl,
          goodsparams1: currentParams,
          goodsparams2: "",
          // shopname: this.goodsData.shopname,
          // goodsprice: this.goodsData.price,
          number: this.nums
        });
        axios
          .post(homeUrl() + "cartstableManageJsonAdd/", datas, {
            emulateJSON: true
          })
          .then(
            result => {
              console.log(result);
              if (result.data.status == "ok") {
                this.messShow = true;
                this.message = "添加成功";
              }
            },
            error => {
              this.$vux.toast.text("网络请求失败....", "bottom");
              console.log(error);
            }
          );
          this.show13 = !this.show13;
        // }
       
    },
    addBuy() {
      this.confirmAdd = false;
      this.confirmBuy = true;
      this.colorType = false;
      this.show13 = !this.show13;
      var colorArr = this.goodsData.color;
       this.goodsDataColor = this.goodsData.goodsparams1.split("，");
      this.goodsDataSize = this.goodsData.goodsparams2.split("，");
    },
    go_cart() {
      this.$router.push({ name: "cart", params: {} });
    },
    doShowToast() {
      this.$vux.toast.show({
        text: "toast"
      });
    },
    go_buy() {
      var parmamsObj = {};
      var parmamsArr = [];
      parmamsObj.number = this.nums;
      parmamsObj.params1 = this.tasteChooses;
      parmamsObj.params2 = this.sizeChooses;
      parmamsObj.goodsimage = this.itemImgUrl[0].img;
      parmamsObj.shopname = this.goodsData.shopname;
      parmamsObj.goodsprice = this.goodsData.shop_price;
      parmamsObj.freightPrice = this.goodsData.transportmoney;
      parmamsObj.freightRiskPrice = "0";
      parmamsObj.keywords = this.goodsData.keywords;
      parmamsObj.goodsname = this.goodsData.goodsname;
      parmamsObj.goodsid = this.goodsData.goodsid;

      parmamsArr.push(parmamsObj);
      // if(parmamsArr[0].arams1=""||parmamsArr[0].params2==""){
      //   this.tankuang=true
      // }else{
         this.$router.push({
        name: "order_confirm",
        params: {
          goodsMonery: this.goodsData.shop_price,
          comfirGoodsInfo: parmamsArr,
          
        }
      });

      // }
      console.log(parmamsArr)
     
    },
    // 浏览记录
    myLookHository() {
      var datas = qs.stringify({
        wxid: this.wxOpenId,
        // goodsname: this.goodsData.goodsname,
        goodsid: this.goodsData.goodsid,
        // goodsimage: this.itemImgUrl[0].img,
        // goodsparams1: this.goodsData.color,
        // goodsparams2: this.goodsData.size,
        // shopname: this.goodsData.shopname,
        // goodsprice: this.goodsData.price,
        tablename: "lookhistory"
      });
      axios
        .post(homeUrl() + "favoriteAndLookTableManageJsonAdd/", datas, {
          emulateJSON: true
        })
        .then(
          result => {
            console.log(",,,,,,,,,,,,,,,;000000");
            console.log(result);
            if (result.data.status == "ok") {
              console.log("浏览记录成功添加");
            }
          },
          error => {
            this.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    tasteChoose(value) {
      console.log(value)
      this.$data.tasteChooses = this.$data.tasteChoose + value;
    },
    sizeChoose(value) {
      console.log(value);
      this.sizeChooses = value;
    },
    // 底部的加入购物车
    addCartTan() {
      this.confirmAdd = true;
      this.confirmBuy = false;
      this.colorType = false;
      this.show13 = !this.show13;
      // console.log(this.goodsData.color);
      var colorArr = this.goodsData.color;
       this.goodsDataColor = this.goodsData.goodsparams1.split("，");
      this.goodsDataSize = this.goodsData.goodsparams2.split("，");
    },
    // 浏览记录添加
    myHistory() {
      var that = this;
      this.show8 = true;
      var datas = qs.stringify({
        wxid: this.wxOpenId,
        tablename: "lookhistory"
      });
      axios
        .post(homeUrl() + "favoriteAndLookTableManageJsonSelect/", datas, {
          emulateJSON: true
        })
        .then(
          result => {
            console.log(result.data.data);
            if (result.data.status == "ok") {
              that.$data.myViewData = result.data.data;
            }
          },
          error => {
            that.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    // 添加用户积分
    addUserJiFen(scores){
            var datas = qs.stringify({
        wxid: this.wxOpenId,
        optionName: JSON.stringify(["jifen"]),
        optionNumber: scores
      });
      axios
        .post(homeUrl() + "addUserSomeNumber/", datas, { emulateJSON: false })
        .then(
          result => {
            console.log(result);
          },
          error => {
            this.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    consoleIndex(index) {
      console.log(index);
      console.log("商品 详情 评价 点击事件")
      return;
      this.$vux.loading.show({
        text: "loading"
      });
      var that = this;
      setTimeout(() => {
        this.$vux.loading.hide();
        that.$data.index = index;
        if (index == 0) {
          that.$data.indexs = 0;
        }
        if (index == 1) {
          that.$data.indexs = 1;
          // console.log(this.goodsData.details)
          var details = decodeURIComponent(this.goodsData.details);
          console.log(details);
          this.goodsDetail = details;
        }
        if (index == 2) {
          that.$data.indexs = 2;
          that.openComment();
        }
        $(".vux-swiper").scrollTop(0);
      }, 500);
    },
    // 商品详情
    requestDetail() {
      var that = this;

      if (this.goodsId == undefined){
        this.goodsId = localStorage.getItem("goodsid")
      } else {
        localStorage.setItem("goodsid" , this.goodsId)
      }



      var datas = qs.stringify({
        goodsid: this.goodsId
      });
      axios
        .post(homeUrl() + "goodsSelectByid/", datas, { emulateJSON: true })
        .then(
          result => {
            if (result.data.status == "ok") {
              console.log("hhhhhhhhhhhhhhh")
              that.$data.goodsData = result.data.data;
              console.log(that.$data.goodsData)

              that.$data.goodsDetail = decodeURIComponent(result.data.data.details);
          
              that.$data.ismiaosha=result.data.data.isinmiaosha;

              that.$data.ismiaosha = result.data.data.isinmiaosha == "true" ? true : false;

              that.$data.guige = that.createGuigeJson(result.data.data.goodsparams1)
              that.$data.canshu = that.createGuigeJson(result.data.data.goodsparams2)
              
              var swiperImg = that.$data.goodsData.lunbo;
              const swiperItem = swiperImg.map((item, index) => ({
                url: "",
                img: homeUrl() + item.image
              }));
              that.$data.itemImgUrl = swiperItem;
            }
          },
          error => {
            that.$data.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    // 评论
    openComment() {
      var commentsData = qs.stringify({
        goodsid: this.goodsId,
      });
      axios
        .post(homeUrl() + "commentJsonQuery/", commentsData, {
          emulateJSON: true
        })
        .then(
          result => {
            console.log(result);
            if (result.data.status == "ok") {
              this.evalDatas = result.data.data;
            }
          },
          error => {
            this.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
    // 添加分享记录
    addShareData(type){
        var commentsData = qs.stringify({
          goodsid: this.goodsId,
          wxid:this.wxOpenId,
          sharepath:type
        });
        axios
          .post(homeUrl() + "addShare/", commentsData, {
            emulateJSON: true
          })
          .then(
            result => {
              console.log("添加分享及路了")
              console.log(result);
                alert("微信好友分享成功，并赠送您20积分");
              
              // if (result.data.status == "ok") {
              //   this.evalDatas = result.data.data;
              // }
            },
            error => {
              this.$vux.toast.text("网络请求失败....", "bottom");
              console.log(error);
            }
          );
    },
    createGuigeJson(guige) {
      var guigeArr = []
      console.log("ooooooooooo")
      console.log(guige)
      var bigArr = guige.split("/")
      for (var i = 0; i < bigArr.length; i++) {
          var tempDic = {}
          var minTitle = bigArr[i].split(":")[0]
          var minArr = bigArr[i].split(":")[1] == undefined ? [] : bigArr[i].split(":")[1].split(",")
          tempDic.title = minTitle
          tempDic.data = minArr
          guigeArr.push(tempDic)
      }

      return guigeArr
    },
    //  收藏列表
    requestFavouriteData(){
     console.log("lll9999")
      var datas = qs.stringify({
        wxid:"oCBm3vxlqwJjUbBDshKiQ50IFSjs",
        tablename:"favorite"
      });
      axios
        .post(homeUrl() + "favoriteAndLookTableManageJsonSelect/", datas, { emulateJSON: true })
        .then(
          result => {
            console.log("ppp0000000")
            console.log(result);
           if(result.data.status=="ok"){
             var myFavourite=result.data.data;
             for(var i=0;i<myFavourite.length;i++){
               console.log("llllllll9999")
               console.log(this.goodsId)
             console.log(myFavourite[i].goods.goodsid)
              if(myFavourite[i].goods.goodsid==this.goodsData.goodsid){
                this.srcData="static/cart/ysc.png"
              }
             }
           }
          },
          error => {
            this.$vux.toast.text("网络请求失败....", "bottom");
            console.log(error);
          }
        );
    },
  },
  created: function() {
       
  },
  mounted: function() {
     //  商品详情数据请求
    this.requestDetail();
    this.requestFavouriteData()
    //引入微信jssdk
    var wx = require('weixin-js-sdk'); //引入sdk
    $.get(
			"http://www.dangsh.top/wxjssdk/", 
      {url: location.href.split('#')[0]} , 
			function(data){
          var that=this;        
				// alert(JSON.stringify(data))
				console.log("拿到结果了")
				console.log(data)
				wx.config({
					debug: true, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
					appId: "wx619c085e365678c4", // 必填，公众号的唯一标识
					timestamp: data.timestamp + "", // 必填，生成签名的时间戳
					nonceStr: data.nonceStr, // 必填，生成签名的随机串
					signature: data.signature,// 必填，签名，见附录1
					jsApiList: ['chooseImage' , 'onMenuShareAppMessage' , 'onMenuShareTimeline' , 'startRecord' , 'stopRecord' , 'playVoice'] // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
				});


				wx.ready(function () {
					// alert("weixinready 了")
					wx.onMenuShareTimeline({
						title: '贾福祥', // 分享标题
						link: location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
						imgUrl: 'wode 第一次', // 分享图标
						success: function (confirm) {
							// 用户确认分享后执行的回调函数
              // 添加分享记录
              alert("我分享了朋友圈")
              that.addShareData("朋友圈分享")
              // 增加积分
             that.addUserJiFen("20");
              
              
						},
						cancel: function (cancel) {
							alert("cancel")
						}
					});


          wx.onMenuShareAppMessage({
            title: '贾福祥', // 分享标题
            desc: '贾福祥', // 分享描述
            link: location.href, // 分享链接，该链接域名或路径必须与当前页面对应的公众号JS安全域名一致
            imgUrl: '', // 分享图标
            type: 'link', // 分享类型,music、video或link，不填默认为link
            dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
            success: function () {
            // 用户确认分享后执行的回调函数
               // 添加分享记录
              alert("我分享了微信好友")
               
              that.addShareData("微信好友分享")
              // 增加积分
             that.addUserJiFen("20");
            },
            cancel: function () {
              // 用户取消分享后执行的回调函数
              alert("分享失败。。。。。。")
            }
          });


				})
					
				wx.error(function (res) {
					// config信息验证失败会执行error函数，如签名过期导致验证失败，具体错误信息可以打开config的debug模式查看，也可以在返回的res参数中查看，对于SPA可以在这里更新签名。
					alert(JSON.stringify(res))
				})

			} 
			
    );
    // 浏览记录定时器
    setTimeout(() => {
      // cons
      this.myLookHository();
      this.addUserJiFen("100");
    }
    , 120000);
  },
  beforeDestroy: function() {
    console.log("已销毁");
    //  this.beginShou("lookhistory")
  }
};
</script>
<style>
.details {
  margin-top: 10px;
  background: #ffffff;
  /* width: 100%; */
  height: 100%;
}
.details p {
  font-size: 12px;
  line-height: 20px;
  padding: 20px;
}
.details img {
  width: 100%;
}
.dialog-box {
  background: #ffffff;
  /* height: 30rem; */
  padding-left: 0.625rem;
  padding-right: 0.625rem;
  /* position: fixed; */
  /* bottom: 0rem; */
}
/* .weui-dialog {
  width: 100% !important;
  max-width: 100% !important;
  top: 76% !important;
} */
.dialog-top {
  display: flex;
  /*height: 110px;*/
  padding-bottom: 1em;
  width: 100%;
  /* background: #CC0010; */
  padding-top: 0.9375rem;
  border-bottom: 1px solid #ebebeb;
}
.bottom_ {
  /* position: fixed; */
  bottom: 0;
  height: 2.875rem;
  line-height: 2.875rem;
  /* background: #CC0010; */
  display: flex;
}


.addCart {
  flex: 1;
  background: #ffbf01;
  color: #ffffff;
  text-align: center;
  border-top-left-radius:10px;
  border-bottom-left-radius:10px;
  height: 2.4em;
  line-height: 2.4em;
  font-size:0.9em;
}
.buyIt {
  flex: 1;
  background: #ff6a00;
  color: #fff;
  text-align: center;
  border-top-right-radius:10px;
  border-bottom-right-radius:10px;
  height: 2.4em;
  line-height: 2.4em;
  font-size:0.9em;
}
.circle {
  position: absolute;
  top: 0.3125rem;
}
.dialog-img img {
  width: 5.9375rem;
  height: 5.9375rem;
}
.dialog-img {
  width: 7.5rem;
}
.dialog-text {
  flex: 1;
  text-align: left;
  line-height: 25px;
}
.dialog-close {
  float: right;
  width: 3.125rem;
}
.dialog-close span {
  font-size: 1.25rem;
}
#color {
  color: #cc0010;
  margin-right: 0.3125rem;
}
.buyNum {
  display: flex;
  border-bottom: 1px solid #ebebeb;
}
.allshops {
  display: flex;
  font-size: 0.75rem;
}
.shop—item {
  flex: 1;
}
.shop-ping {
  flex: 1;
  text-align: center;
}
.shop-person {
  flex: 1;
  text-align: right;
}
.buyNum .num {
  width: 100px;
  margin-top: 10px;
  line-height: 1.875rem;
}
.backMoney {
  height: 1.25rem;
  background: #ed393d;
  color: #ffffff;
  text-align: center;
  display: inline-block;
  line-height: 1.25rem;
  font-size: 0.75rem;
  padding-left: 6px;
  padding-right: 6px;
}
.buyNum .xnum {
  flex: 1;
  margin-top: -15px;
}
.bottom_ {
  display: flex;
  margin-top: 0.9375rem;
}
/* .bottoms_{
margin-top: .9375rem;
color: #ffffff
} */
.carts {
  width: 6.25rem;
  height: 2.5625rem;
  margin-right: 0.625rem;
}
.carts button {
  background: #ebebeb;
}
.carts img {
  width: 1.9375rem;
  height: 1.5625rem;
  padding-top: 0.3125rem;
}
.accounts {
  flex: 1;
  color: #ffffff !important;
}
.accounts button {
  background: #333333;
  color: #ffffff !important;
  height: 2.625rem;
}
.go_buy {
  width: 100%;
}
.go_buy button {
  width: 100%;
  /* height: 2.875rem; */
  background: #cc0010;
  /* margin-top: 1.25rem; */
  color: #ffffff;
  font-size: 14px;
}
.goods_format_ {
  border-bottom: 1px solid #ebebeb;
  text-align: left;
  padding-bottom: 0.625rem;
}
.goods_format_ ._format {
  line-height: 1.875rem;
  width: 95%;
  padding-left: 15px;
  margin-top: 0.3125rem;
}
.goods_format_ .demo6-item {
  /* width: 5.625rem !important;
  height: 1.625rem !important; */
  line-height: 1.625rem;
  text-align: center;
  border-radius: 3px;
  border: 1px solid #ccc;
  background-color: #fff;
  margin-right: 0.5rem !important;
  margin-top: 10px;
  font-size: 0.75rem;
}
.wrapsDetail{
  margin-bottom: 46px
}
.day {
  color: #666666;
  font-size: 0.75rem;
  display: -webkit-box;
  word-break: break-all;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
}
.grid-center {
  display: block;
  text-align: center;
  color: #666;
}
.fadeInUp {
  animation-name: fadeInUp;
}
.swiper-demo-img img {
  width: 16px;
}
.goods_right img {
  height: 16px;
}
.goods_wrap {
  width: 100%;
  background: #ffffff;
  /* padding: 0.5rem 0rem; */
  margin-bottom: 10px;
}
.goods_info {
  display: flex;
  width: 95%;
  padding-left: 0.5rem;
}
.goods_left {
  flex: 1;
  line-height: 20px;
}
.goods_left p:nth-child(2) {
  font-size: 0.75rem;
  color: #666666;
}
.goods_left p:nth-child(1) {
  font-size: 0.875rem;
}
.goods_right {
  width: 50px;
  text-align: center;
}
.goods_right p {
  font-size: 0.75rem;
  color: #553737;
}
.good_price {
  width: 95%;
  padding-left: 0.5rem;
  margin-top: 0.5rem;
}
#price {
  font-size: 0.875rem;
}
#free {
  float: right;
  font-size: 0.75rem;
  color: #666666;
}
.goods_format {
  width: 100%;
  /* height: 120px; */
  background: #ffffff;
  margin-bottom: 10px;
}
.chooseType {
  padding: 0.625rem;
  /* line-height: 1.25rem; */
  font-size: 12px;
  border-bottom: 1px solid #ebebeb;
}
.chooseType img {
  width: 0.625rem;
  float: right;
  margin-top: 2px;
  vertical-align: middle;
}
#xiaImg {
  height: 0.625rem;
  width: 1.25rem;
  margin-top: 4px;
  float: right;
  vertical-align: middle;
}
._format {
  line-height: 35px;
  width: 95%;
  padding-left: 15px;
  margin-top: 10px;
}
._checker {
  width: 95%;
  padding-left: 10px;
}
.demo6-item {
  /*width: 100px;*/
  padding: 0 1em;
  height: 26px;
  line-height: 26px;
  text-align: center;
  border-radius: 3px;
  border: 1px solid #ccc;
  background-color: #fff;
  margin-right: 15px;
  margin-top: 10px;
}
.demo6-item-selected {
  background: #ffffff url(../../../src/assets/demo/active.png) no-repeat right
    bottom;
  border-color: #ff4a00 !important;
}
.format_info {
  /* width: 100%; */
  /* height: 160px; */
  background: #ffffff;
  margin-bottom: 10px;
  /* padding-right: 10px; */
}
.guige {
  line-height: 40px;
  width: 95%;
  padding-left: 15px;
  margin-top: 10px;
}
.format_more {
  /* width: 95%; */
  /* padding-left: 15px; */
  margin-top: 10px;
  display: flex;
}
.guigename {
  flex: 1;
  text-align: left;
}
.guiges {
  flex: 3;
}
.p_p {
  color: #999999;
}
.pp_name {
  margin-left: 40px;
  color: #666666;
}
.bottom_bar {
  width: 100%;
  height: 50px;
  position: fixed;
  bottom: 0px;
  display: flex;
  background: #ffffff;
  font-size: 0.875rem;
}
.badge {
  position: absolute;
  left: 37%;
}
.bottom_item:nth-child(1) {
  flex: 1;
  /* border-right: 1px solid #cccccc; */
  text-align: center;
  padding-top: 0.2rem;
  font-size: 0.75rem;
}
.bottom_item:nth-child(1) img {
  width: 24px;
  height: 22px;
}
.bottom_item:nth-child(2) img {
  width: 24px;
  padding-top: 0.2rem;
  height: 22px;
}
.bottom_item:nth-child(2) {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
}
.bottom_item:nth-child(3) img {
  width: 24px;
  padding-top: 0.2rem;
  height: 22px;
}
.bottom_item:nth-child(3) {
  flex: 1;
  text-align: center;
  font-size: 0.75rem;
}

.bottom_item:nth-child(4) {
  flex: 2;
  background: rgb(237, 204, 57);
  color: #ffffff;
  text-align: center;
  line-height: 50px;
}
.bottom_item:nth-child(5) {
  flex: 2;
  background: #ed393d;
  color: #ffffff;
  text-align: center;
  line-height: 50px;
}
.demo6-item {
  /*width: 6.25rem !important;*/
  height: 1.625rem !important;
  line-height: 26px;
  text-align: center;
  border-radius: 3px;
  border: 1px solid #ccc;
  background-color: #fff;
  margin-right: 0.9375rem !important;
  margin-top: 10px;
}
/* .demo6-item-selected {
  background: #ffffff url(../../../src/assets/demo/active.png) no-repeat right
    bottom;
  border:1px solid#ff4a00;
} */
.weui-cells:before {
  border-top: 0px !important;
}
.weui-cells:after {
  border-bottom: 0px !important;
}
.myView {
  /* width: 100%; */
  padding-left: 20px;
  /* background: red */
  background: #ffffff;
}
.myViews {
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid #ebebeb;
}
.myView p {
  text-align: center;
  line-height: 30px;
  margin-bottom: 10px;
  color: #cccccc;
}
.myView img {
  width: 110px;
  height: 110px;
}
.myView .fonts {
  display: -webkit-box;
  word-break: break-all;
  text-overflow: ellipsis;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  overflow: hidden;
  line-height: 30px;
  color: #666;
}
#vux-close {
  float: right;
  /* font-size:30px; */
}
.overwrite-title-demo {
  margin-top: 0.4rem;
}
.isinMiaosha{
  height: 50px;
  display: flex;
  color: #ffffff;
  }
.ismiaoFirst{
  flex: 3;
  background: #F32C78;
  font-size: 16px;
  padding-left: 20px;
  line-height: 50px;
  
}
.ismiaoFirst #texthua{
  text-decoration: line-through
}
.ismiaoSecnd{
  flex: 2;
  background: #FDEAE8;
  text-align: center;
  font-size: 10px;
  color:#666
}
.ismiaoSecnd .huodongTime{
  color: #F32C78;
  font-size: 10px
  
}
.ismiaoSecnd .day {
  background-color:#F32C78;
  color:#fff;
  text-align:center;
  display:inline-block;
  padding:0 2px;
  border-radius:3px;
  /* font-size: 12px */
}
</style>
